package com.agile.leetcode.easy.countOdds;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/4/9 9:56
 */
public class CountOdds {
    public static void main(String[] args) {
        int low=3;
        int high=7;
        CountOdds odds=new CountOdds();
        int i = odds.countOdds(low, high);
        System.out.println(i);
    }
    public int countOdds(int low,int high){
        // 定义总数
        int count=0;
        // 遍历
        for (int i = low; i <=high ; i++) {
            if ((i&1)==1){
                // 是奇数
                count++;
            }
        }
        return count;
    }
}
